<!DOCTYPE html>
<!-- saved from url=(0046)https://www.cnblogs.com/zerodai/p/9710556.html -->
<html lang="zh-cn"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="origin">
    <meta property="og:description" content="系列目录 1. CentOS的安装和网卡的配置 2. 安装.NET Core SDK和发布网站 3. Nginx的安装和配置 4. 安装守护服务(Supervisor) Nginx简介 &amp;amp;em">
    <meta http-equiv="Cache-Control" content="no-transform">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园</title>
    <link id="favicon" rel="shortcut icon" href="https://common.cnblogs.com/favicon.ico?v=20200522" type="image/x-icon">
    
    <link rel="stylesheet" href="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/blog-common.min.css">
    <link id="MainCss" rel="stylesheet" href="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/bundle-custom.min.css">
    <link type="text/css" rel="stylesheet" href="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/custom.css">
    <link id="mobile-style" media="only screen and (max-width: 767px)" type="text/css" rel="stylesheet" href="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/bundle-custom-mobile.min.css">
    
    <link type="application/rss+xml" rel="alternate" href="https://www.cnblogs.com/zerodai/rss">
    <link type="application/rsd+xml" rel="EditURI" href="https://www.cnblogs.com/zerodai/rsd.xml">
    <link type="application/wlwmanifest+xml" rel="wlwmanifest" href="https://www.cnblogs.com/zerodai/wlwmanifest.xml">
    <script async="" src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/analytics.js.下载"></script><script src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/jquery-2.2.0.min.js.下载"></script>
    <script src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/blog-common.min.js.下载"></script>
    <script>
        var currentBlogId = 230326;
        var currentBlogApp = 'zerodai';
        var cb_enable_mathjax = false;
        var isLogined = false;
        var skinName = 'Custom';
    </script>
    
    
    
<link rel="preload" href="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/f.txt" as="script"><script type="text/javascript" src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/f.txt"></script><script src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/pubads_impl_2020052101.js.下载" async=""></script><link rel="prefetch" href="https://1a3cc3e0756e205d9ce7d30bbf820286.safeframe.googlesyndication.com/safeframe/1-0-37/html/container.html"><link rel="prefetch" href="https://tpc.googlesyndication.com/safeframe/1-0-37/html/container.html"></head>
<body><div class="esa-mobile-menu"></div>
    <a name="top"></a>
    
    
<!--done-->
<div id="home">
<div id="header">
	<div id="blogTitle">
        <a id="lnkBlogLogo" href="https://www.cnblogs.com/zerodai/"><img id="blogLogo" src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/logo.gif" alt="返回主页"></a>		
		
<!--done-->
<h1><a id="Header1_HeaderTitle" class="headermaintitle HeaderMainTitle" href="https://www.cnblogs.com/zerodai/">ZeroDai</a>
</h1>
<h2>
衣带渐宽终不悔，为伊消得人憔悴。
</h2>




		
	</div><!--end: blogTitle 博客的标题和副标题 -->
	<div id="navigator">
		
<ul id="navList">
<li><a id="blog_nav_sitehome" class="menu" href="https://www.cnblogs.com/">
博客园</a>
<i></i></li>
<li>
<a id="blog_nav_myhome" class="menu" href="https://www.cnblogs.com/zerodai/">
首页</a>
<i></i></li><li><a id="blog_nav_tags" class="menu" href="https://www.cnblogs.com/zerodai/tag">标签</a><i></i></li>
<li>

<a id="blog_nav_newpost" class="menu" href="https://i.cnblogs.com/EditPosts.aspx?opt=1">
新随笔</a>
<i></i></li>
<li>
<a id="blog_nav_contact" class="menu" href="https://msg.cnblogs.com/send/ZeroDai">
联系</a><i></i></li>
<li>
<a id="blog_nav_rss" class="menu" href="javascript:void(0)" data-rss="https://www.cnblogs.com/zerodai/rss/">
订阅</a>
<!--<partial name="./Shared/_XmlLink.cshtml" model="Model" /></li>--><i></i></li>
<li>
<a id="blog_nav_admin" class="menu" href="https://i.cnblogs.com/">
管理</a>
<i></i></li>
</ul>


		<div class="blogStats">
			
			<span id="stats_post_count">随笔 - 
13&nbsp; </span>
<span id="stats_article_count">文章 - 
0&nbsp; </span>
<span id="stats-comment_count">评论 - 
5</span>

			
		</div><!--end: blogStats -->
	</div><!--end: navigator 博客导航栏 -->
</div><!--end: header 头部 -->

<div id="main">
	<div id="mainContent">
	<div class="forFlow">
		<div id="post_detail">
    <!--done-->
    <div id="topics">
        <div class="post">
            <h1 class="postTitle">
                
<a id="cb_post_title_url" class="postTitle2" href="https://www.cnblogs.com/zerodai/p/9710556.html">CentOS&amp;.NET Core初试-3-Nginx的安装和配置</a>

            </h1>
            <div class="clear"></div>
            <div class="postBody">
                
<div id="cnblogs_post_body" class="blogpost-body cnblogs-markdown">
    <h2 id="idx_0"><span>系列目录</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_0" class="esa-anchor">#</a></h2>
<ol>
<li><a href="https://www.cnblogs.com/zerodai/p/9704300.html" target="_blank">CentOS的安装和网卡的配置</a></li>
<li><a href="https://www.cnblogs.com/zerodai/p/9704213.html" target="_blank">安装.NET Core SDK和发布网站</a></li>
<li><a href="https://www.cnblogs.com/zerodai/p/9710556.html" target="_blank">Nginx的安装和配置</a></li>
<li><a href="https://www.cnblogs.com/zerodai/p/9721524.html" target="_blank">安装守护服务(Supervisor)</a></li>
</ol>
<h2 id="idx_1"><span>Nginx简介</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_1" class="esa-anchor" style="opacity: 0;">#</a></h2>
<p>  Nginx是一个免费的，开源的，高性能的HTTP服务器和反向代理，以及IMAP / POP3代理服务器。<br>
  Nginx以其高性能，稳定性，丰富的功能集，简单的配置和低资源消耗而闻名。<br>
  Nginx使用更加可扩展的事件驱动（异步）架构,此体系结构在负载下使用较小但更重要的可预测内存量。即使您不希望同时处理数千个请求，您仍然可以从Nginx的高性能和小内存占用中受益。<br>
  Nginx可以向各个方向扩展：从最小的VPS一直到大型服务器集群。</p>
<h2 id="idx_2"><span>安装Nginx</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_2" class="esa-anchor">#</a></h2>
<h3 id="idx_3"><span>安装 epel</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_3" class="esa-anchor">#</a></h3>
<pre><div class="esa-clipboard-button" data-clipboard-target="#copy_target_0" title="复制代码">Copy</div><code class="language-shell hljs" id="copy_target_0">sudo yum install epel-release
</code></pre>
<h3 id="idx_4"><span>安装 Nginx</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_4" class="esa-anchor">#</a></h3>
<pre><div class="esa-clipboard-button" data-clipboard-target="#copy_target_1" title="复制代码">Copy</div><code class="language-shell hljs" id="copy_target_1">sudo yum install nginx
</code></pre>
<h3 id="idx_5"><span>启动 Nginx</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_5" class="esa-anchor">#</a></h3>
<p>Nginx 不会自己启动，启动命令:</p>
<pre><div class="esa-clipboard-button" data-clipboard-target="#copy_target_2" title="复制代码">Copy</div><code class="language-shell hljs" id="copy_target_2">sudo systemctl start nginx
</code></pre>
<h3 id="idx_6"><span>关闭防火墙</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_6" class="esa-anchor">#</a></h3>
<p>  如果外部浏览器输入该机IP还是访问不了，说明有防火墙正在运行，关闭HTTP 和 HTTPS的防火墙：</p>
<pre><div class="esa-clipboard-button" data-clipboard-target="#copy_target_3" title="复制代码">Copy</div><code class="hljs dockerfile" id="copy_target_3">sudo firewall-<span class="hljs-keyword">cmd</span><span class="bash"> --permanent --zone=public  --add-service=http
</span>sudo firewall-<span class="hljs-keyword">cmd</span><span class="bash"> --permanent --zone=public --add-service=https
</span>sudo firewall-<span class="hljs-keyword">cmd</span><span class="bash"> --reload
</span></code></pre>
<h3 id="idx_7"><span>访问验证</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_7" class="esa-anchor">#</a></h3>
<p>外部浏览器访问成功，说明Nginx安装成功。<br>
<img src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/625771-20180926222929051-1475683230.png" alt="nginx访问成功"></p>
<h3 id="idx_8"><span>开机启动</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_8" class="esa-anchor">#</a></h3>
<p>最后，因为Nginx默认是不主动开启的，为了能够在系统启动就开启Nginx：</p>
<pre><div class="esa-clipboard-button" data-clipboard-target="#copy_target_4" title="复制代码">Copy</div><code class="language-shell hljs" id="copy_target_4">sudo systemctl enable nginx
</code></pre>
<h2 id="idx_9"><span>端口映射配置</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_9" class="esa-anchor">#</a></h2>
<h3 id="idx_10"><span>查看nginx.conf</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_10" class="esa-anchor">#</a></h3>
<pre><div class="esa-clipboard-button" data-clipboard-target="#copy_target_5" title="复制代码">Copy</div><code class="language-shell hljs" id="copy_target_5">vi /etc/nginx/nginx.conf
</code></pre>
<h3 id="idx_11"><span>修改nginx配置</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_11" class="esa-anchor">#</a></h3>
<p>nginx.conf文件http配置内容,并且<code>i</code>进去注释掉http配置下server的默认配置内容<code>Esc</code>+<code>:wq</code>保存后退出。</p>
<pre><div class="esa-clipboard-button" data-clipboard-target="#copy_target_6" title="复制代码">Copy</div><code class="language-shell hljs" id="copy_target_6">    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;
    #【解释】nginx会加载 /etc/nginx/conf.d文件夹下所有的conf文件的配置
<span class="hljs-meta"> #</span><span class="bash">   server {</span>
<span class="hljs-meta"> #</span><span class="bash">       listen       80 default_server;</span>
<span class="hljs-meta"> #</span><span class="bash">       listen       [::]:80 default_server;</span>
<span class="hljs-meta"> #</span><span class="bash">        server_name  _; </span>
<span class="hljs-meta"> #</span><span class="bash">        root         /usr/share/nginx/html;</span>
<span class="hljs-meta"> #</span><span class="bash"></span>
<span class="hljs-meta"> #</span><span class="bash">        <span class="hljs-comment"># Load configuration files for the default server block.</span></span>
<span class="hljs-meta"> #</span><span class="bash">        include /etc/nginx/default.d/*.conf;</span>
<span class="hljs-meta"> #</span><span class="bash"></span>
<span class="hljs-meta"> #</span><span class="bash">        location / {</span>
<span class="hljs-meta"> #</span><span class="bash">        }</span>
<span class="hljs-meta"> #</span><span class="bash"></span>
<span class="hljs-meta"> #</span><span class="bash">        error_page 404 /404.html;</span>
<span class="hljs-meta"> #</span><span class="bash">            location = /40x.html {</span>
<span class="hljs-meta"> #</span><span class="bash">        }</span>
<span class="hljs-meta"> #</span><span class="bash"></span>
<span class="hljs-meta"> #</span><span class="bash">        error_page 500 502 503 504 /50x.html;</span>
<span class="hljs-meta"> #</span><span class="bash">            location = /50x.html {</span>
<span class="hljs-meta"> #</span><span class="bash">        }</span>
<span class="hljs-meta"> #</span><span class="bash">    }</span>
</code></pre>
<h3 id="idx_12"><span>创建新配置</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_12" class="esa-anchor">#</a></h3>
<p>根据nginx配置文件有提示，在/etc/nginx/conf.d文件夹下为hellocore项目新建一个netcore.conf文件，文件配置如下</p>
<pre><div class="esa-clipboard-button" data-clipboard-target="#copy_target_7" title="复制代码">Copy</div><code class="language-yxml" id="copy_target_7">server {
    listen       80;
    location / {
    proxy_pass http://localhost:5000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection keep-alive;
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
    }
}
</code></pre>
<p>重启nginx</p>
<pre><div class="esa-clipboard-button" data-clipboard-target="#copy_target_8" title="复制代码">Copy</div><code class="language-shell hljs" id="copy_target_8">nginx -s reload # systemctl restart nginx
</code></pre>
<h3 id="idx_13"><span>特别注意</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_13" class="esa-anchor">#</a></h3>
<p><strong>外部访问有可能会报502错误</strong></p>
<p>原因：<br>
SELinux配置问题<br>
解决：<br>
方法1.关闭SELinux<br>
输入：<code>sestatus</code>,如果<code>SELinux status: enabled</code> ，表示开启，输入<code>vi /etc/selinux/config</code> 修改配置：<code>SELINUX=disabled</code>。&nbsp;<br>
方法2.将nginx添加至SELinux的白名单</p>
<p>逐行执行如下命令：</p>
<pre><div class="esa-clipboard-button" data-clipboard-target="#copy_target_9" title="复制代码">Copy</div><code class="language-shell hljs" id="copy_target_9">yum install policycoreutils-python
cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M mynginx
semodule -i mynginx.pp
</code></pre>
<h3 id="idx_14"><span>访问验证</span><a href="https://www.cnblogs.com/zerodai/p/9710556.html#idx_14" class="esa-anchor">#</a></h3>
<p><img src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/625771-20180926223821191-1090224472.png" alt="nginx配置成功"></p>

</div>
<div id="MySignature" style="display: block;"><div class="esa-post-signature"> 
                    <p>作者：<a href="https://github.com/DaiZero">DZero</a></p> 
                    <p>出处：<a href="https://www.cnblogs.com/zerodai/p/9710556.html">https://www.cnblogs.com/zerodai/p/9710556.html</a></p> 
                    <p>本站使用「<a href="https://creativecommons.org/licenses/by/4.0" target="_blank">署名 4.0 国际</a>」创作共享协议，转载请在文章明显位置注明作者及出处。</p> 
                </div></div>
<div class="clear"></div>
<div id="blog_post_info_block"><div id="BlogPostCategory">
    分类: 
            <a href="https://www.cnblogs.com/zerodai/category/1431067.html" target="_blank">CentOS&amp;.NET Core</a></div>
<div id="EntryTag">
    标签: 
            <a href="https://www.cnblogs.com/zerodai/tag/CentOS/">CentOS</a>,             <a href="https://www.cnblogs.com/zerodai/tag/.NET%20Core/">.NET Core</a></div>

    <div id="blog_post_info">
<div id="green_channel">
        <a href="javascript:void(0);" id="green_channel_digg" onclick="DiggIt(9710556,cb_blogId,1);green_channel_success(this,&#39;谢谢推荐！&#39;);">好文要顶</a>
        <a id="green_channel_follow" onclick="follow(&#39;42559361-dcc7-e311-8d02-90b11c0b17d6&#39;);" href="javascript:void(0);">关注我</a>
    <a id="green_channel_favorite" onclick="AddToWz(cb_entryId);return false;" href="javascript:void(0);">收藏该文</a>
    <a id="green_channel_weibo" href="javascript:void(0);" title="分享至新浪微博" onclick="ShareToTsina()"><img src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/icon_weibo_24.png" alt=""></a>
    <a id="green_channel_wechat" href="javascript:void(0);" title="分享至微信" onclick="shareOnWechat()"><img src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/wechat.png" alt=""></a>
</div>
<div id="author_profile">
    <div id="author_profile_info" class="author_profile_info">
            <a href="https://home.cnblogs.com/u/zerodai/" target="_blank"><img src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/20140420001651.png" class="author_avatar" alt=""></a>
        <div id="author_profile_detail" class="author_profile_info">
            <a href="https://home.cnblogs.com/u/zerodai/">ZeroDai</a><br>
            <a href="https://home.cnblogs.com/u/zerodai/followees/">关注 - 38</a><br>
            <a href="https://home.cnblogs.com/u/zerodai/followers/">粉丝 - 3</a>
        </div>
    </div>
    <div class="clear"></div>
    <div id="author_profile_honor"></div>
    <div id="author_profile_follow">
                <a href="javascript:void(0);" onclick="follow(&#39;42559361-dcc7-e311-8d02-90b11c0b17d6&#39;);return false;">+加关注</a>
    </div>
</div>
<div id="div_digg" style="width: 300px;"><div class="favorite" onclick="AddToWz(cb_entryId);return false;"><span class="favoritenum" id="favorite_count"></span></div>
    <div class="diggit" onclick="votePost(9710556,&#39;Digg&#39;)">
        <span class="diggnum" id="digg_count">0</span>
    </div>
    <div class="buryit" onclick="votePost(9710556,&#39;Bury&#39;)">
        <span class="burynum" id="bury_count">0</span>
    </div>
    <div class="clear"></div>
    <div class="diggword" id="digg_tips">
    </div>
</div>

<script type="text/javascript">
    currentDiggType = 0;
</script></div>
    <div class="clear"></div>
    <div id="post_next_prev">

    <a href="https://www.cnblogs.com/zerodai/p/9704300.html" class="p_n_p_prefix">« </a> 上一篇：    <a href="https://www.cnblogs.com/zerodai/p/9704300.html" title="发布于 2018-09-26 23:03">CentOS&amp;.NET Core初试-1-CentOS的安装和网卡的配置</a>
    <br>
    <a href="https://www.cnblogs.com/zerodai/p/9710595.html" class="p_n_p_prefix">» </a> 下一篇：    <a href="https://www.cnblogs.com/zerodai/p/9710595.html" title="发布于 2018-09-27 08:42">CentOS&amp;.NET Core初试系列</a>

</div>
</div>
            </div>
            <div class="postDesc">posted @ 
<span id="post-date">2018-09-26 23:04</span>&nbsp;
<a href="https://www.cnblogs.com/zerodai/">ZeroDai</a>&nbsp;
阅读(<span id="post_view_count">907</span>)&nbsp;
评论(<span id="post_comment_count">0</span>)&nbsp;
<a href="https://i.cnblogs.com/EditPosts.aspx?postid=9710556" rel="nofollow">编辑</a>&nbsp;
<a href="javascript:void(0)" onclick="AddToWz(9710556);return false;">收藏</a></div>
        </div>
	    
	    
    </div><!--end: topics 文章、评论容器-->
</div>
<script src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/highlight.min.js.下载"></script>
<script>markdown_highlight();</script>
<script>
    var allowComments = true, cb_blogId = 230326, cb_blogApp = 'zerodai', cb_blogUserGuid = '42559361-dcc7-e311-8d02-90b11c0b17d6';
    var cb_entryId = 9710556, cb_entryCreatedDate = '2018-09-26 23:04', cb_postType = 1; 
    loadViewCount(cb_entryId);
    loadSideColumnAd();
</script><a name="!comments"></a>
<div id="blog-comments-placeholder"></div>
<script>
    var commentManager = new blogCommentManager();
    commentManager.renderComments(0);
</script>

<div id="comment_form" class="commentform">
    <a name="commentform"></a>
    <div id="divCommentShow"></div>
    <div id="comment_nav"><span id="span_refresh_tips"></span><a href="javascript:void(0);" onclick="return RefreshCommentList();" id="lnk_RefreshComments" runat="server" clientidmode="Static">刷新评论</a><a href="https://www.cnblogs.com/zerodai/p/9710556.html#" onclick="return RefreshPage();">刷新页面</a><a href="https://www.cnblogs.com/zerodai/p/9710556.html#top">返回顶部</a></div>
    <div id="comment_form_container" style="visibility: visible;"><div class="login_tips">
    注册用户登录后才能发表评论，请 
    <a rel="nofollow" href="javascript:void(0);" class="underline" onclick="return login(&#39;commentform&#39;);">登录</a>
     或 
    <a rel="nofollow" href="javascript:void(0);" class="underline" onclick="return register();">注册</a>，
    <a href="https://www.cnblogs.com/">访问</a> 网站首页。
</div></div>
    <div class="ad_text_commentbox" id="ad_text_under_commentbox"></div>
    <div id="ad_t2"><a href="http://www.ucancode.com/index.htm" target="_blank" onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;Link&#39;, &#39;click&#39;, &#39;T2-ucancode&#39;)">【推荐】超50万行VC++源码: 大型组态工控、电力仿真CAD与GIS源码库</a><br><a href="https://www.wenjuan.com/s/3uIjeq0/" target="_blank" onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;Link&#39;, &#39;click&#39;, &#39;T2-博客园问卷调查&#39;)">【推荐】了解你才能更懂你，博客园首发问卷调查，助力社区新升级</a><br><a href="https://fineui.com/" target="_blank" onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;Link&#39;, &#39;click&#39;, &#39;T2-FineUI&#39;)">【推荐】12年经典 UI 控件库 FineUI，支持 ASP.NET Core 3.1</a><br></div>
    <div id="opt_under_post"></div>
    <script async="async" src="./CentOS&amp;.NET Core初试-3-Nginx的安装和配置 - ZeroDai - 博客园_files/gpt.js.下载"></script>
    <script>
        var googletag = googletag || {};
        googletag.cmd = googletag.cmd || [];
    </script>
    <script>
        googletag.cmd.push(function () {
            googletag.defineSlot("/1090369/C1", [300, 250], "div-gpt-ad-1546353474406-0").addService(googletag.pubads());
            googletag.defineSlot("/1090369/C2", [468, 60], "div-gpt-ad-1539008685004-0").addService(googletag.pubads());
            googletag.pubads().enableSingleRequest();
            googletag.enableServices();
        });
    </script>
    <div id="cnblogs_c1" class="c_ad_block" style="">
        <div id="div-gpt-ad-1546353474406-0" style="height: 250px; width: 300px;"><div id="google_ads_iframe_/1090369/C1_0__container__" style="border: 0pt none; width: 300px; height: 250px;"></div></div>
    </div>
    <div id="under_post_news"></div>
    <div id="cnblogs_c2" class="c_ad_block" style="">
        <div id="div-gpt-ad-1539008685004-0" style="height: 60px; width: 468px;"><div id="google_ads_iframe_/1090369/C2_0__container__" style="border: 0pt none; width: 468px; height: 60px;"></div></div>
    </div>
    <div id="under_post_kb"></div>
    <div id="HistoryToday" class="c_ad_block">
<b>历史上的今天：</b>
<br>

2018-09-26    <a href="https://www.cnblogs.com/zerodai/p/9704300.html">CentOS&amp;.NET Core初试-1-CentOS的安装和网卡的配置</a>
    <br>
</div>
    <script type="text/javascript">
        fixPostBody();
        deliverBigBanner();
setTimeout(function() { incrementViewCount(cb_entryId); }, 50);        deliverAdT2();
        deliverAdC1();
        deliverAdC2();
        loadNewsAndKb();
        loadBlogSignature();
LoadPostCategoriesTags(cb_blogId, cb_entryId);        LoadPostInfoBlock(cb_blogId, cb_entryId, cb_blogApp, cb_blogUserGuid);
        GetPrevNextPost(cb_entryId, cb_blogId, cb_entryCreatedDate, cb_postType);
        loadOptUnderPost();
        GetHistoryToday(cb_blogId, cb_blogApp, cb_entryCreatedDate);
    </script>
</div>
	</div><!--end: forFlow -->
	</div><!--end: mainContent 主体内容容器-->

	<div id="sideBar">
		<div id="sideBarMain">
			
<div id="sidebar_news" class="newsItem"><!--done-->
<h3 class="catListTitle">公告</h3>

<div id="blog-news">
    <script type="text/javascript">window['__document_write_ajax_callbacks__']['4']();</script><script type="text/javascript">window['__document_write_ajax_callbacks__']['5']();</script><script>window['__document_write_ajax_callbacks__']['1']();</script>
<script type="text/javascript">window['__document_write_ajax_callbacks__']['6']();</script><script type="text/javascript">window['__document_write_ajax_callbacks__']['2']();</script>
    <div id="profile_block">
        昵称：
        <a href="https://home.cnblogs.com/u/zerodai/">
            ZeroDai
        </a>
        <br>
        园龄：
        <a href="https://home.cnblogs.com/u/zerodai/" title="入园时间：2014-04-20">
            6年1个月
        </a>
        <br>
        粉丝：
        <a href="https://home.cnblogs.com/u/zerodai/followers/">
            3
        </a>
        <br>
        关注：
        <a href="https://home.cnblogs.com/u/zerodai/followees/">
            38
        </a>
        <div id="p_b_follow">
<a href="javascript:void(0)" onclick="follow(&#39;42559361-dcc7-e311-8d02-90b11c0b17d6&#39;)">+加关注</a></div>
        <script type="text/javascript">window['__document_write_ajax_callbacks__']['7']();</script><script>window['__document_write_ajax_callbacks__']['3']();</script>
    </div>
</div>

</div>

<div id="sidebar_ad"></div>
			<div id="blog-calendar" style="display:none"></div><script>loadBlogDefaultCalendar();</script>
			
			<div id="leftcontentcontainer">
				<div id="blog-sidecolumn">
<!-- 搜索 -->
<div id="sidebar_search" class="sidebar-block">
    
</div>

<!-- 常用链接 -->
<div id="sidebar_shortcut" class="sidebar-block">
    <div class="catListLink">
<h3 class="catListTitle">
常用链接
</h3>
<ul>
		<li>

<a href="https://www.cnblogs.com/zerodai/p/" title="我的博客的随笔列表">我的随笔</a>
</li>
		<li>

<a href="https://www.cnblogs.com/zerodai/MyComments.html" title="我的发表过的评论列表">我的评论</a>
</li>
		<li>

<a href="https://www.cnblogs.com/zerodai/OtherPosts.html" title="我评论过的随笔列表">我的参与</a>
</li>
		<li>

<a href="https://www.cnblogs.com/zerodai/RecentComments.html" title="我的博客的评论列表">最新评论</a>
</li>
		<li>

<a href="https://www.cnblogs.com/zerodai/tag/" title="我的博客的标签列表">我的标签</a>
</li>

</ul>
<div id="itemListLin_con" style="display:none;">
<ul>

</ul>
</div>
</div>


</div>

<!-- 最新随笔 -->



<!-- 我的标签 -->
<div id="sidebar_toptags" class="sidebar-block">
    <div class="catListTag">
<h3 class="catListTitle">我的标签</h3>
<ul>

        <li>
            <a href="https://www.cnblogs.com/zerodai/tag/CentOS/">CentOS</a>(5)
        </li>
        <li>
            <a href="https://www.cnblogs.com/zerodai/tag/.NET%20Core/">.NET Core</a>(5)
        </li>
        <li>
            <a href="https://www.cnblogs.com/zerodai/tag/C%23/">C#</a>(2)
        </li>
        <li>
            <a href="https://www.cnblogs.com/zerodai/tag/.Net/">.Net</a>(1)
        </li>
        <li>
            <a href="https://www.cnblogs.com/zerodai/tag/HTML5/">HTML5</a>(1)
        </li>
        <li>
            <a href="https://www.cnblogs.com/zerodai/tag/JavaScript/">JavaScript</a>(1)
        </li>
        <li>
            <a href="https://www.cnblogs.com/zerodai/tag/NuGet/">NuGet</a>(1)
        </li>
        <li>
            <a href="https://www.cnblogs.com/zerodai/tag/%E5%89%8D%E7%AB%AF/">前端</a>(1)
        </li>
    

</ul>
</div>


</div>

<!-- 积分与排名 -->


<!-- 随笔分类、随笔档案、文章分类、新闻分类、相册、链接 -->
<div id="sidebar_categories">
    
        <div id="sidebar_postcategory" class="catListPostCategory sidebar-block">
            <h3 class="catListTitle">
                

随笔分类



            </h3>


            <ul>

                        <li>
                            
<a href="https://www.cnblogs.com/zerodai/category/1431067.html" rel="" target="">
    CentOS&amp;.NET Core(5)
</a>
 

                        </li>

            </ul>


        </div>
        <div id="sidebar_postarchive" class="catListPostArchive sidebar-block">
            <h3 class="catListTitle">
                

随笔档案



            </h3>


            <ul>

                        <li>
                            
<a href="https://www.cnblogs.com/zerodai/archive/2019/05.html" rel="" target="">
    2019年5月(1)
</a>
 

                        </li>
                        <li>
                            
<a href="https://www.cnblogs.com/zerodai/archive/2019/01.html" rel="" target="">
    2019年1月(1)
</a>
 

                        </li>
                        <li>
                            
<a href="https://www.cnblogs.com/zerodai/archive/2018/09.html" rel="" target="">
    2018年9月(5)
</a>
 

                        </li>
                        <li>
                            
<a href="https://www.cnblogs.com/zerodai/archive/2016/09.html" rel="" target="">
    2016年9月(1)
</a>
 

                        </li>
                        <li>
                            
<a href="https://www.cnblogs.com/zerodai/archive/2016/07.html" rel="" target="">
    2016年7月(1)
</a>
 

                        </li>
                        <li>
                            
<a href="https://www.cnblogs.com/zerodai/archive/2016/04.html" rel="" target="">
    2016年4月(1)
</a>
 

                        </li>
                        <li>
                            
<a href="https://www.cnblogs.com/zerodai/archive/2015/06.html" rel="" target="">
    2015年6月(3)
</a>
 

                        </li>

            </ul>


        </div>

</div>

<!-- 最新评论 -->
<div id="sidebar_recentcomments" class="sidebar-block">
    <div class="catListComment">
<h3 class="catListTitle">最新评论</h3>

	<div class="RecentCommentBlock">
        <ul>
                    <li class="recent_comment_title"><a href="https://www.cnblogs.com/zerodai/p/10796535.html">1. Re:用ProGet搭建本地私有NuGet仓库</a></li>
                    <li class="recent_comment_body">@ David Smith gf安装程序...</li>
                    <li class="recent_comment_author">--ZeroDai</li>
                    <li class="recent_comment_title"><a href="https://www.cnblogs.com/zerodai/p/10796535.html">2. Re:用ProGet搭建本地私有NuGet仓库</a></li>
                    <li class="recent_comment_body">下载的是web安装程序吧，还有一个离线安装程序的。</li>
                    <li class="recent_comment_author">--David Smith gf</li>
                    <li class="recent_comment_title"><a href="https://www.cnblogs.com/zerodai/p/9721524.html">3. Re:CentOS&amp;.NET Core初试-4-安装守护服务(Supervisor)</a></li>
                    <li class="recent_comment_body">@ 其实我不笨谢谢支持...</li>
                    <li class="recent_comment_author">--ZeroDai</li>
                    <li class="recent_comment_title"><a href="https://www.cnblogs.com/zerodai/p/9721524.html">4. Re:CentOS&amp;.NET Core初试-4-安装守护服务(Supervisor)</a></li>
                    <li class="recent_comment_body">mark 好详细</li>
                    <li class="recent_comment_author">--其实我不笨</li>
                    <li class="recent_comment_title"><a href="https://www.cnblogs.com/zerodai/p/9710595.html">5. Re:CentOS&amp;.NET Core初试系列</a></li>
                    <li class="recent_comment_body">牛逼牛逼</li>
                    <li class="recent_comment_author">--你的乐哥哥</li>
        </ul>
    </div>
</div>


</div>



<!-- 阅读排行榜 -->
<div id="sidebar_topviewedposts" class="sidebar-block">
    <div class="catListView">
<h3 class="catListTitle">阅读排行榜</h3>
	<div id="TopViewPostsBlock">
        <ul style="word-break:break-all">
                    <li>
                        <a href="https://www.cnblogs.com/zerodai/p/5367781.html">
                            1. C# 实现保留两位小数的方法(47570)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/zerodai/p/5706449.html">
                            2. 图片查看__实现旋转，拖拽，放大，缩小(2342)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/zerodai/p/10224946.html">
                            3. 错误及异常处理-[PathTooLongException]指定的路径或文件名太长(2171)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/zerodai/p/9710556.html">
                            4. CentOS&amp;.NET Core初试-3-Nginx的安装和配置(906)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/zerodai/p/9721524.html">
                            5. CentOS&amp;.NET Core初试-4-安装守护服务(Supervisor)(882)
                        </a>
                    </li>
        </ul>
    </div>
</div>


</div>

<!-- 评论排行榜 -->
<div id="sidebar_topcommentedposts" class="sidebar-block">
    <div class="catListFeedback">
<h3 class="catListTitle">评论排行榜</h3>
	<div id="TopFeedbackPostsBlock">
        <ul style="word-break:break-all">
                    <li>
                        <a href="https://www.cnblogs.com/zerodai/p/9721524.html">
                            1. CentOS&amp;.NET Core初试-4-安装守护服务(Supervisor)(2)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/zerodai/p/10796535.html">
                            2. 用ProGet搭建本地私有NuGet仓库(2)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/zerodai/p/9710595.html">
                            3. CentOS&amp;.NET Core初试系列(1)
                        </a>
                    </li>
        </ul>
    </div>
</div>


</div>

<!-- 推荐排行榜 -->
<div id="sidebar_topdiggedposts" class="sidebar-block">
    
<div id="topdigg_posts_wrap">
    <div class="catListView">
        <h3 class="catListTitle">推荐排行榜</h3>
        <div id="TopDiggPostsBlock">
            <ul style="word-break: break-all">
                        <li>
                            <a href="https://www.cnblogs.com/zerodai/p/10796535.html">
                                1. 用ProGet搭建本地私有NuGet仓库(3)
                            </a>
                        </li>
                        <li>
                            <a href="https://www.cnblogs.com/zerodai/p/5367781.html">
                                2. C# 实现保留两位小数的方法(2)
                            </a>
                        </li>
                        <li>
                            <a href="https://www.cnblogs.com/zerodai/p/9704213.html">
                                3. CentOS&amp;.NET Core初试-2-安装.NET Core SDK和发布网站(1)
                            </a>
                        </li>
                        <li>
                            <a href="https://www.cnblogs.com/zerodai/p/9721524.html">
                                4. CentOS&amp;.NET Core初试-4-安装守护服务(Supervisor)(1)
                            </a>
                        </li>
            </ul>
        </div>
    </div>
</div>
</div></div>
                    <script>loadBlogSideColumn();</script>
			</div>
			
		</div><!--end: sideBarMain -->
	</div><!--end: sideBar 侧边栏容器 -->
	<div class="clear"></div>
	</div><!--end: main -->
	<div class="clear"></div>
	<div id="footer">
		<!--done-->
Copyright © 2020 ZeroDai
<br><span id="poweredby">Powered by .NET Core on Kubernetes</span>



	<div> Powered By <a href="https://www.cnblogs.com/" target="_blank">Cnblogs</a> |
            Theme <a href="https://github.com/esofar/cnblogs-theme-silence" target="_blank">Silence v1.1.3</a></div></div><!--end: footer -->
</div><!--end: home 自定义的最大容器 -->


    


<script type="text/javascript">
    $.silence({
        catalog: {
            enable: true,
            move: true,
            index: true,
            level1: 'h2',
            level2: 'h3',
            level3: 'h4',
        },
        signature: {
            enable: true,
            author: 'DZero',
            home: 'https://github.com/DaiZero',
            license: '署名 4.0 国际',
            link: 'https://creativecommons.org/licenses/by/4.0'
        },
        github: {
            enable: true,
            color: '#fff',
            fill: '#151513',
            link: 'https://github.com/DaiZero',
        }
    });
</script><a href="https://github.com/DaiZero" class="github-corner" title="Follow me on GitHub">
                        <svg width="60" height="60" viewBox="0 0 250 250" style="fill:#151513; color:#fff; z-index: 999999; position: fixed; top: 0; border: 0; left: 0; transform: scale(-1, 1);" aria-hidden="true">
                            <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
                            <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
                            <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
                        </svg>
                    </a><div class="esa-catalog">
                        <div class="esa-catalog-contents" style="display: block;">
                            <div class="esa-catalog-title">CONTENTS</div>
                            <a class="esa-catalog-close">✕</a>
                        <ul><li class="li_h2" title="系列目录">
                            <i class="idx_0"></i><a class="esa-anchor-link"><span class="level1">1. </span>系列目录</a>
                        </li><li class="li_h2" title="Nginx简介">
                            <i class="idx_1"></i><a class="esa-anchor-link"><span class="level1">2. </span>Nginx简介</a>
                        </li><li class="li_h2" title="安装Nginx">
                            <i class="idx_2"></i><a class="esa-anchor-link"><span class="level1">3. </span>安装Nginx</a>
                        </li><li class="li_h3" title="安装 epel">
                            <i class="idx_3"></i><a class="esa-anchor-link"><span class="level2">3.1. </span>安装 epel</a>
                        </li><li class="li_h3" title="安装 Nginx">
                            <i class="idx_4"></i><a class="esa-anchor-link"><span class="level2">3.2. </span>安装 Nginx</a>
                        </li><li class="li_h3" title="启动 Nginx">
                            <i class="idx_5"></i><a class="esa-anchor-link"><span class="level2">3.3. </span>启动 Nginx</a>
                        </li><li class="li_h3" title="关闭防火墙">
                            <i class="idx_6"></i><a class="esa-anchor-link"><span class="level2">3.4. </span>关闭防火墙</a>
                        </li><li class="li_h3" title="访问验证">
                            <i class="idx_7"></i><a class="esa-anchor-link"><span class="level2">3.5. </span>访问验证</a>
                        </li><li class="li_h3" title="开机启动">
                            <i class="idx_8"></i><a class="esa-anchor-link"><span class="level2">3.6. </span>开机启动</a>
                        </li><li class="li_h2" title="端口映射配置">
                            <i class="idx_9"></i><a class="esa-anchor-link"><span class="level1">4. </span>端口映射配置</a>
                        </li><li class="li_h3" title="查看nginx.conf">
                            <i class="idx_10"></i><a class="esa-anchor-link"><span class="level2">4.1. </span>查看nginx.conf</a>
                        </li><li class="li_h3" title="修改nginx配置">
                            <i class="idx_11"></i><a class="esa-anchor-link"><span class="level2">4.2. </span>修改nginx配置</a>
                        </li><li class="li_h3" title="创建新配置">
                            <i class="idx_12"></i><a class="esa-anchor-link"><span class="level2">4.3. </span>创建新配置</a>
                        </li><li class="li_h3" title="特别注意">
                            <i class="idx_13"></i><a class="esa-anchor-link"><span class="level2">4.4. </span>特别注意</a>
                        </li><li class="li_h3" title="访问验证">
                            <i class="idx_14"></i><a class="esa-anchor-link"><span class="level2">4.5. </span>访问验证</a>
                        </li></ul></div>
                    </div><div class="esa-toolbar">
                <button class="esa-toolbar-gotop"><div class="tips">返回顶部</div></button>
                <button class="esa-toolbar-contents"><div class="tips">阅读目录</div></button>
                <button class="esa-toolbar-follow"><div class="tips">关注博主</div></button>
            </div><script type="text/javascript">getFollowStatus('42559361-dcc7-e311-8d02-90b11c0b17d6');</script></body></html>